package com.molichuxing.services.business.convertor;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import com.molichuxing.services.infrastructure.bean.AdvertBean;
import com.molichuxing.services.infrastructure.dto.response.AdvertDto;

public class Convert {

	public static List<AdvertDto> toAdvertDto(List<AdvertBean> beanList) {
		 List<AdvertDto> dtoList = null;
	        if (beanList != null && beanList.size() > 0) {
	            dtoList = new ArrayList<>();
	            for (AdvertBean bean : beanList) {
	                dtoList.add(toAdvertDto(bean));
	            }
	        }
	        return dtoList;
	}

    public static AdvertDto toAdvertDto(AdvertBean bean) {
    	AdvertDto beanDto = null;
        if (bean != null) {
            beanDto = new AdvertDto();
            BeanUtils.copyProperties(bean, beanDto);
            beanDto.setAddTime(bean.getGmtCreate());
        }
        return beanDto;
    }

}
